package com.forezp.thinking.chapter18;

import java.io.*;

/**
 * Created by forezp on 2017/12/8.
 */
public class StoringRecoverData {

    public static void main(String[] args) throws IOException {

        DataOutputStream out = new DataOutputStream(
                new BufferedOutputStream(
                        new FileOutputStream(Constants.OUT_FILE_TXT_NAME)));
        out.writeDouble(1.15);
        out.writeBoolean(true);
        out.writeChar(1);
        out.writeInt(12);
        out.writeDouble(1.15);
        out.close();

        DataInputStream in = new DataInputStream(
                new BufferedInputStream(
                        new FileInputStream(Constants.OUT_FILE_TXT_NAME)));
        System.out.println(in.readDouble());
    }
}
